package main

import (
	"slices"
)

func main() {
	rotate([]int{-1, -100, 3, 99}, 2)
	rotate([]int{1, 2, 3, 4, 5, 6, 7}, 3)
	rotate([]int{1}, 3)
}
func rotate(nums []int, k int) {
	k = k % len(nums)
	slices.Reverse(nums)
	slices.Reverse(nums[:k])
	slices.Reverse(nums[k:])
}
